﻿namespace Useful.MVP2
{
    public abstract class ComplexDetailPresenter<IV, ListT, ItemT> : BaseDetailPresenter<ComplexDetailModel<ItemT>, IV, IRepository<ListT, ItemT>>
        where ItemT : class, new()
        where IV : IComplexDetailView<ListT, ItemT>
    {
        protected ComplexDetailPresenter(IV view, IRepository<ListT, ItemT> repository, IPresenterImpl presenterImpl)
            : base(view, repository, presenterImpl)
        {
        }

        protected override void OnViewInited(InitDetailViewEventArgs e)
        {
            base.OnViewInited(e);

            Model.Item = (ItemT)e.Item;
            Model.InsertMode = Model.Item == null;
        }
    }
}
